//
//  CustomNavigationCoutroller.m
//  Credit
//
//  Created by WangZhenyu on 16/6/4.
//  Copyright © 2016年 WangZhenyu. All rights reserved.
//

#import "CustomNavigationController.h"
#import "GlobalFunction.h"

@implementation CustomNavigationController

- (instancetype)init{
    if (self = [super init]) {
        self.fd_fullscreenPopGestureRecognizer.enabled = YES;
//        [self.navigationBar setShadowImage:[UIImage new]];
        [self.navigationBar setTranslucent:YES];
        
    }
    return self;
}

- (instancetype)initWithRootViewController:(UIViewController *)rootViewController{
    if (self = [super initWithRootViewController:rootViewController]) {
        self.fd_fullscreenPopGestureRecognizer.enabled = YES;
//        [self.navigationBar setShadowImage:[UIImage new]];
        [self.navigationBar setTranslucent:YES];
        
    }
    return self;
}

- (void)setNavigationBarStyle:(BOOL)formal{
    if (formal) {
        [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:19.0f]}];
        self.navigationBar.tintColor = [UIColor whiteColor];
        self.navigationBar.barStyle = UIBarStyleDefault;
        [self.navigationBar setBackgroundImage:getColorToImage(RGB(107, 118, 233))
                                forBarPosition:UIBarPositionAny
                                    barMetrics:UIBarMetricsDefault];
        [self.navigationBar setTranslucent:YES];
    }else{
        [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: RGB(45, 45, 45), NSFontAttributeName:[UIFont systemFontOfSize:19.0f]}];
        self.navigationBar.tintColor = ThemeColor;
        self.navigationBar.barStyle = UIBarStyleDefault;
        [self.navigationBar setTranslucent:YES];
    }
}

@end
